﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BattleMaster_IRCbot.UserCommands
{
    class Help : Command
    {
        public override string Name { get { return _name; } }
        public override string[] Aliasses { get { return _aliasses; } }
        public override string Description { get { return _description; } }
        public override string ShortDesc { get { return _shortDesc; } }

        public Help()
        {
            _name = "Help";
            _aliasses = new string[] { "?" };
            _description = "Provides a list and enxtended eplainations for all available commands.";
            _shortDesc = "Your guide to the game.";
        }

        public override void Verb(Game game, string msgOrigen, string[] cmd)
        {
            // Get refrence to player's character object
            Character playerCharacter = null;
            foreach (Character C in game.Characters)
            {
                if (C.Name.ToLower() == msgOrigen.ToLower()) playerCharacter = C;
            }

            string output = "";

            output += "Available Commands: ";
            int i = 0;
            foreach(Command C in game.Commands)
            {
                i++;
                output += C.Name;
                if (i < game.Commands.Count()) output += ", ";
            }

            if (playerCharacter != null)
            {
                i = 0;
                output += ", ";
                foreach (Command C in playerCharacter.Commands)
                {
                    i++;
                    output += C.Name;
                    if (i < playerCharacter.Commands.Count()) output += ", ";
                }
            }
            game.ircHandler.sendNotice(msgOrigen, output);
        }
    }
}
